<%@ page import="javax.servlet.jsp.JspWriter" pageEncoding="utf-8"%>
<%@ page import="com.flute.haflute.monitor.ClusterStatusMonitor"%>
<%@ page import="com.flute.haflute.monitor.UniversalMonitorMsg"%>
<%@ page import="com.flute.haflute.monitor.UniversalMsgComparetor"%>
<%@ page import="com.flute.haflute.monitor.StatusMessage"%>
<%@ page language="java" import="java.util.*" %>
<%
	String path = request.getContextPath();
	String ip = request.getParameter("ip");
	String time = request.getParameter("time");
	if(time != null){
		time = time.replaceAll("-","");
	}
	
	
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>历史监控信息列表</title>
<link href="<%=path%>/css/admin.css" rel="stylesheet" type="text/css"/>
<link href="<%=path%>/css/pub.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="crawler/js/startDate.js"></script>
<script language="javascript" type="text/javascript" src="<%=path%>/js/sort.js"></script>
</head>

<body>
<!--head start-->
<div class="header"><img src="images/SystemName.gif" /></div>
<!--head end-->
<!--content start-->
<div class="content">
        <jsp:include page="/page/left_menu_admin.jsp" />
        <div class="right"> 
        <div class="title">
         <form  method="post" name="form">
        时间： <input type="text" name="time"   onFocus="CalendarWebControl.show(this,false,this.value);"/> 
         <input type="button" value="查询 "  onClick="dosubmitForm()" />
         </form>
        </div>
        <table width="940" border="0" cellspacing="1" class="sortable" id="mytable" >
		  <tr  class="h_tr">
			<td width="150" height="18" bgcolor="#f3f5f8">节点</td>
			<td width="180" bgcolor="#f3f5f8">模块</td>
			<td width="150">主题</td>
			<td width="250">内容</td>
			<td width="50" bgcolor="#f3f5f8">说明</td>
			<td width="160" bgcolor="#f3f5f8">汇报时间</td>
		  </tr>
    
    <%
        	List<UniversalMonitorMsg> list = ClusterStatusMonitor
        			.getHistoryMonitorInfo(time);
           if(list!=null){
        	   Collections.sort(list, new UniversalMsgComparetor());

           	Iterator<UniversalMonitorMsg> it = list.iterator();
           	while (it.hasNext()) {
           		UniversalMonitorMsg universalMsg = it.next();
           		if (ip != null) {
           			if (ip.equals(universalMsg.getIp())) {
           

        	
        %>
	    <tr>
	        <td align='left'><%=universalMsg.getIp()%></td>
	        <td align='left'><%=universalMsg.getMoudle()%></td>
	        <td align='left'><%=universalMsg.getStatusMsg().topic%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().content%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().explanation == null ? "-"
										: universalMsg.getStatusMsg().explanation%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().reportDate%></td>
	    </tr>
    <%
    	}
    		} else {
    %>
        		
        		  <tr>
	        <td align='left'><%=universalMsg.getIp()%></td>
	        <td align='left'><%=universalMsg.getMoudle()%></td>
	        <td align='left'><%=universalMsg.getStatusMsg().topic%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().content%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().explanation == null ? "-"
									: universalMsg.getStatusMsg().explanation%></td>
	    	<td align='left'><%=universalMsg.getStatusMsg().reportDate%></td>
	    </tr>
        		<%
        			}
        			}
           }
        		%>
      </table>
	</div>
	<div class="clear"></div>
	 
</div>
<!--content end-->
<div class="footer"></div>
</body>
<script type="text/javascript" language="javascript">

	function dosubmitForm(){
	     document.forms[0].action="./historymonitorparamlist.jsp?time="+document.getElementById("time").value; 
	     document.forms[0].submit()
	}
   </script>
</html>